package at.ac.lbg.media.vis.framework.model;

import incboard.api.DataItemInterface;

public class ThemeLandscapeHexboardDataItem implements DataItemInterface {
	
	public Artwork aw;
    private String uRI;
    private int x;
    private int y;
    private int dimensions = 0;
	
	public ThemeLandscapeHexboardDataItem(Artwork artwork, int dimensions) {
		aw = artwork;
		this.dimensions = dimensions;
	}

	@Override
	public int getCol() {
		return x;
	}

	@Override
	public Double getDistance(DataItemInterface other) {
		ThemeLandscapeHexboardDataItem tlOther = (ThemeLandscapeHexboardDataItem) other;
		int proximity = 0;
		for (Category cat : aw.getCategories()) {
			for (Category catOther : tlOther.aw.getCategories()) {
				if (cat.getId() == catOther.getId()) {
					proximity++;
					break;
				}
			}
		}
		return new Double(dimensions - proximity);
//		Double a = aw.getX() - tlOther.aw.getX();
//		Double b = aw.getY() - tlOther.aw.getY();
//		// Satz des Pythagoras, dritte Seite im rechtwinkligen Dreieck ;-) a^2+b^2 = c^2
//		Double c = a*a + b*b;
//		c = Math.sqrt(c);
		
//		return c;
	}

	@Override
	public int getRow() {
		return y;
	}

	@Override
	public String getURI() {
		return uRI;
	}

	@Override
	public void setCol(int x) {
		this.x = x;

	}

	@Override
	public void setRow(int y) {
		this.y = y;

	}

}
